package com.spring.ext.demos.ext.myimport;

import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

import java.util.function.Predicate;

public class MyImportSelect implements ImportSelector {
    @Override
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
        return new String[]{"com.spring.ext.demos.web.User"};
    }

    /**
     * 返回的条件不满足则不实例化
     * s 是类名
     * @return
     */
    @Override
    public Predicate<String> getExclusionFilter() {
        return new Predicate<String>() {
            @Override
            public boolean test(String s) {
                return s.equals("my");
            }
        };
    }
}
